CC: Drop idempotent type maps#22910
Merged
odersky merged 29 commits intoscala:mainfrom Apr 11, 2025
Merged
Conversation
Contributor
|
not really, it's crashing if I turn on tracing for TypeComparer, and it also crashes on main import language.experimental.captureChecking
import annotation.showAsInfix
import compiletime.*
import compiletime.ops.int.*
enum Tuple:
case EmptyTuple()
case `*:`[T, U <: Tuple](x: T, y: U)
object Tuple {
import Tuple.*
/** Fold a tuple `(T1, ..., Tn)` into `F[T1, F[... F[Tn, Z]...]]]` */
type Fold[Tup <: Tuple, Z, F[_, _]] = Tup match
case EmptyTuple => Z
case h *: t => F[h, Fold[t, Z, F]]
type Union[T <: Tuple] = Fold[T, Nothing, [x, y] =>> x | y]
opaque type Oops[h, t <: Tuple] >: Union[t] = Union[h *: t]
} |
# Conflicts: # compiler/src/dotty/tools/dotc/cc/Setup.scala
Simplifies previous too convoluted logic.
No need to refer to keep track of openExistentials.
…he binder Some failing tests: - pos test lists.scala - neg test i21920.scala Both are moved to pending. Also some errors in neg test curried-closures.scala look wrong, these seem to be analogous to the errors in lists.scala.
Use an explicit `reported` set. The previous logic suppressed some real non-duplicate errors.
A capture set variable can appear several times at different variances in a type. So interpolating at the first variance encountered is wrong. Instead, we need to compute the overall variance and interpolate according to it.
No need to construct a complicated BiTypeMap anymore.
Also simplify BiTypeMap: the special cases for TypeParamRefs with underlying NoType are no linger needed since isTrackableRef was changed to include these TypeParamRefs.
Had to turn an assertion into a condition to make it pass
Fresh instances cannot subsume TermParamRefs since that would be a level violation.
This fixes one error in the lists pos test and several spurious errors in neg tests. There remains an error in lists.scala that has to do with bindings getting lost for polymorphic closures. This needs to be followd up separately.
1. Also apply `SubstBindings` map to root annotations
(previously it was only single `SubstBinding` maps).
2. Don't preserve BiTypeMaps for sets that are set up for
the first time.
67f2c93 to
58d052e
Compare
Schedule another capture checking run when a provisionally solved set is later extended.
This reverts commit a6f1ab2.
Replace healing by assertions that these cases cannot happen anymore.
This might address the Timeout problems we were seeing.
Contributor
Author
|
I am running test on 86970ef for the third time now. The first two did not produce a timeout, whereas before I had timeouts in about half of the runs. |
bracevac
approved these changes
Apr 11, 2025
noti0na1
reviewed
Apr 11, 2025
noti0na1
reviewed
Apr 11, 2025
|
|
||
| // ------ Iteration count of capture checking run | ||
|
|
||
| private var iterCount = 1 |
Member
There was a problem hiding this comment.
Just wondering, do you know the highest number the counter goes when running the tests?
Contributor
Author
There was a problem hiding this comment.
I think there should be at most one extra iteration. I believe that's the case always, but I am not sure about that.
noti0na1
approved these changes
Apr 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reorganize the code so that maps become more manageable
Hopefully this leads to a more efficient system that avoids the timeouts we have been seeing.
Edit: I did see a timeout for 99f5628. As a response:
@sharablevals in the cc package to the currentCCState.Let's see whether this fixes the problem.
Also, tighten a bunch of rules and checks to rule out non-sensical elements in capture sets. This makes the previous
healTypeParamlogic redundant.